package jmvcclab.View;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class OpsPanel extends JPanel implements ActionListener{
        private JButton plus, minus, mult, devide;
        private IOPanel text;

        public OpsPanel(IOPanel p){
        text = p;
        this.setLayout(new GridLayout(4,1, 10, 10));

        plus = new JButton("+");
        plus.addActionListener(this);
        minus = new JButton("-");
        minus.addActionListener(this);
        mult = new JButton("*");
        mult.addActionListener(this);
        devide = new JButton("/");
        devide.addActionListener(this);

        this.add(plus);
        this.add(minus);
        this.add(mult);
        this.add(devide);
    }
    public void actionPerformed(ActionEvent e){
            Object s=e.getSource();
            if(s == plus || s == minus || s == mult || s == devide)
                text.addText(e.getActionCommand());
    }
}
